python iterate dictionary key value

283

python iterate dictionary key value -

thisdict = {
  "1": "C language",
  "2": "Java Language",
  "4": "Python Language",
  "3": "C++",
}

print('\n\n')
#print 2nd record from dictionary

n=2
for index, (key, value) in enumerate(thisdict.items()):
    if index == n:
        print(key, '::', value)
        break					

Comments

Submit
0 Comments